// Created from GenerationTemplate
// For Decisions HL7 Engine
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.Reflection;
using DecisionsFramework.Design.Properties;
using Decisions.HL7.Generated.AbstractMessage;
using Decisions.HL7.DataTypes;
using ST = System.String;
using SI = System.String;
using TX = System.String;
using FT = System.String;
using IS = System.String;
using ID = System.String;
using SNM = System.String;

namespace Decisions.HL7.Message
{
    [DataContract]
	public class TQ : AbstractDataType
    {

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("1 Quantity",1)]
  	    [HL7Field(HL7Version.v23, 1, HL7Repeat.False, HL7Required.True,"CQ")]
  	    [HL7Field(HL7Version.v231, 1, HL7Repeat.False, HL7Required.True,"CQ")]
  	    [HL7Field(HL7Version.v24, 1, HL7Repeat.False, HL7Required.True,"CQ")]
  	    [HL7Field(HL7Version.v25, 1, HL7Repeat.False, HL7Required.True,"CQ")]
  	    [HL7Field(HL7Version.v251, 1, HL7Repeat.False, HL7Required.True,"CQ")]
  	    [HL7Field(HL7Version.v26, 1, HL7Repeat.False, HL7Required.True,"CQ")]
	    public CQ Quantity {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("2 Interval",2)]
  	    [HL7Field(HL7Version.v23, 2, HL7Repeat.False, HL7Required.True,"CM")]
  	    [HL7Field(HL7Version.v231, 2, HL7Repeat.False, HL7Required.True,"RI")]
  	    [HL7Field(HL7Version.v24, 2, HL7Repeat.False, HL7Required.True,"RI")]
  	    [HL7Field(HL7Version.v25, 2, HL7Repeat.False, HL7Required.True,"RI")]
  	    [HL7Field(HL7Version.v251, 2, HL7Repeat.False, HL7Required.True,"RI")]
  	    [HL7Field(HL7Version.v26, 2, HL7Repeat.False, HL7Required.True,"RI")]
	    public RI Interval {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("3 Duration",3)]
  	    [HL7Field(HL7Version.v23, 3, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v231, 3, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v24, 3, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v25, 3, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v251, 3, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v26, 3, HL7Repeat.False, HL7Required.True,"ST")]
	    public ST Duration {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("4 Start Date/Time",4)]
  	    [HL7Field(HL7Version.v23, 4, HL7Repeat.False, HL7Required.True,"TS")]
  	    [HL7Field(HL7Version.v231, 4, HL7Repeat.False, HL7Required.True,"TS")]
  	    [HL7Field(HL7Version.v24, 4, HL7Repeat.False, HL7Required.True,"TS")]
  	    [HL7Field(HL7Version.v25, 4, HL7Repeat.False, HL7Required.True,"TS")]
  	    [HL7Field(HL7Version.v251, 4, HL7Repeat.False, HL7Required.True,"TS")]
  	    [HL7Field(HL7Version.v26, 4, HL7Repeat.False, HL7Required.True,"DTM")]
	    public DTM StartDateTime {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("5 End Date/Time",5)]
  	    [HL7Field(HL7Version.v23, 5, HL7Repeat.False, HL7Required.True,"TS")]
  	    [HL7Field(HL7Version.v231, 5, HL7Repeat.False, HL7Required.True,"TS")]
  	    [HL7Field(HL7Version.v24, 5, HL7Repeat.False, HL7Required.True,"TS")]
  	    [HL7Field(HL7Version.v25, 5, HL7Repeat.False, HL7Required.True,"TS")]
  	    [HL7Field(HL7Version.v251, 5, HL7Repeat.False, HL7Required.True,"TS")]
  	    [HL7Field(HL7Version.v26, 5, HL7Repeat.False, HL7Required.True,"DTM")]
	    public DTM EndDateTime {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("6 Priority",6)]
  	    [HL7Field(HL7Version.v23, 6, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v231, 6, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v24, 6, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v25, 6, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v251, 6, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v26, 6, HL7Repeat.False, HL7Required.True,"ST")]
	    public ST Priority {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("7 Condition",7)]
  	    [HL7Field(HL7Version.v23, 7, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v231, 7, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v24, 7, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v25, 7, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v251, 7, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v26, 7, HL7Repeat.False, HL7Required.True,"ST")]
	    public ST Condition {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("8 Text",8)]
  	    [HL7Field(HL7Version.v23, 8, HL7Repeat.False, HL7Required.True,"TX")]
  	    [HL7Field(HL7Version.v231, 8, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v24, 8, HL7Repeat.False, HL7Required.True,"TX")]
  	    [HL7Field(HL7Version.v25, 8, HL7Repeat.False, HL7Required.True,"TX")]
  	    [HL7Field(HL7Version.v251, 8, HL7Repeat.False, HL7Required.True,"TX")]
  	    [HL7Field(HL7Version.v26, 8, HL7Repeat.False, HL7Required.True,"TX")]
	    public TX Text {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("9 Conjunction",9)]
  	    [HL7Field(HL7Version.v23, 9, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v231, 9, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v24, 9, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v25, 9, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v251, 9, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v26, 9, HL7Repeat.False, HL7Required.True,"ID")]
		[TQConjunctionID]
	    public ID Conjunction {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("10 Order Sequencing",10)]
  	    [HL7Field(HL7Version.v23, 10, HL7Repeat.False, HL7Required.True,"CM")]
  	    [HL7Field(HL7Version.v231, 10, HL7Repeat.False, HL7Required.True,"OSD")]
  	    [HL7Field(HL7Version.v24, 10, HL7Repeat.False, HL7Required.True,"OSD")]
  	    [HL7Field(HL7Version.v25, 10, HL7Repeat.False, HL7Required.True,"OSD")]
  	    [HL7Field(HL7Version.v251, 10, HL7Repeat.False, HL7Required.True,"OSD")]
  	    [HL7Field(HL7Version.v26, 10, HL7Repeat.False, HL7Required.True,"OSD")]
	    public OSD OrderSequencing {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("11 Occurrence Duration",11)]
  	    [HL7Field(HL7Version.v231, 11, HL7Repeat.False, HL7Required.True,"CE")]
  	    [HL7Field(HL7Version.v24, 11, HL7Repeat.False, HL7Required.True,"CE")]
  	    [HL7Field(HL7Version.v25, 11, HL7Repeat.False, HL7Required.True,"CE")]
  	    [HL7Field(HL7Version.v251, 11, HL7Repeat.False, HL7Required.True,"CE")]
  	    [HL7Field(HL7Version.v26, 11, HL7Repeat.False, HL7Required.True,"CWE")]
	    public CWE OccurrenceDuration {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("12 Total Occurrences",12)]
  	    [HL7Field(HL7Version.v231, 12, HL7Repeat.False, HL7Required.True,"NM")]
  	    [HL7Field(HL7Version.v24, 12, HL7Repeat.False, HL7Required.True,"NM")]
  	    [HL7Field(HL7Version.v25, 12, HL7Repeat.False, HL7Required.True,"NM")]
  	    [HL7Field(HL7Version.v251, 12, HL7Repeat.False, HL7Required.True,"NM")]
  	    [HL7Field(HL7Version.v26, 12, HL7Repeat.False, HL7Required.True,"NM")]
	    public NM TotalOccurrences {get;set;}





		public override string GetER7(HL7ParserOptions options) {
			List<string> dataTypeParts = new List<string>();
			dataTypeParts.Add(GetER7TextForDataPart(Quantity, options));
			dataTypeParts.Add(GetER7TextForDataPart(Interval, options));
		    dataTypeParts.Add(Duration);
			dataTypeParts.Add(GetER7TextForDataPart(StartDateTime, options));
			dataTypeParts.Add(GetER7TextForDataPart(EndDateTime, options));
		    dataTypeParts.Add(Priority);
		    dataTypeParts.Add(Condition);
		    dataTypeParts.Add(Text);
		    dataTypeParts.Add(Conjunction);
			dataTypeParts.Add(GetER7TextForDataPart(OrderSequencing, options));
			dataTypeParts.Add(GetER7TextForDataPart(OccurrenceDuration, options));
			dataTypeParts.Add(GetER7TextForDataPart(TotalOccurrences, options));
			return CleanUpTrailingComponentSeps(string.Join("" + options.ComponentSep, dataTypeParts.ToArray()), options);
		}
    }
}

